POV-Ray : Newsgroups : povray.newusers : povray and 3D graphs : Re: povray and 3D graphs Server Time
28 Jul 2024 16:22:42 EDT (-0400)
  Re: povray and 3D graphs  
From: Tim Attwood
Date: 17 Apr 2008 05:54:34
Message: <48071e5a@news.povray.org>
> What I would like to do on your code is to keep the plane where it is
> --- that would be my xy-plane --- and make the helix start from the
> plane and spiral up, because that's how this helix should be as x varies
> according to cos(t) and y to sin(t) and z = t. That is, while x and y
> circle around, z keeps on going up (or down.)

You can rotate unions like any other object, there's a good tutorial in
the manual too.

> So what I think it's happening here is that while I keep on thinking on
> the xyz-axis as I do, the povray puts the z axis as going from outside
> my screen into it. So if I swap y and z I should get what I'd like, and
> apparently I do.

POV uses a left handed coordinate system, like if you point with
your left hand, thumb up is y, pointer finger in is z, and middle
finger right is x. Rotations are the same way, if you trace from your
left palm looping around your fingers that is the direction of rotation
used for each axis.

> I also took your code and plotted it from -25pi to 25pi and it spirals
> just right. Cool. I'm impressed. This is what I'm looking for. Thanks
> for the introduction.

Yeah, Warp knows his stuff =)
I fiddled with his scene a bit...

#include "colors.inc"

camera {
   location <0,2.5,-7>
   right    x*image_width/image_height
   look_at  <0,2,0>
}

light_source {
   <-20, 30, 0>
   White
}
light_source {
   <0,2.5,-8>
   White
}

sky_sphere {
   pigment {
      gradient y
      color_map {
         [0 Black]
         [0.5 Gray75]
         [1 Black]
      }
   }
}

#declare X = function(T) { sin(T) };
#declare Y = function(T) { cos(T) };
#declare Z = function(T) { T };

#declare CylRadius = 0.1;
#declare MinT = 0;
#declare MaxT = 2*pi;
#declare Steps = 100;

union {

   #declare Ind = 0;
   #while(Ind < Steps)
      #declare T1 = MinT + (MaxT-MinT)*Ind/Steps;
      #declare T2 = MinT + (MaxT-MinT)*(Ind+1)/Steps;
      #declare P1 = <X(T1), Y(T1), Z(T1)>;
      #declare P2 = <X(T2), Y(T2), Z(T2)>;
      sphere { P1, CylRadius }
      cylinder { P1, P2, CylRadius }
      #declare Ind = Ind+1;
   #end

   texture {
      pigment {Orange}
      normal {bumps scale 0.02}
      finish {
         specular 0.3
         roughness 0.005
      }
   }

   rotate <-90,0,0>
   translate <0,-1,2.5>
}

plane { y, -1
   pigment {
      cells
      color_map {
         [0 Blue]
         [1 ForestGreen]
      }
   }
}


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.